import 'package:flutter/material.dart';

main() => runApp(MyApp());

// 生成代码快捷键  stl
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: GLHomePage(),
    );
  }
}

class GLHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("基础的widget"),
      ),
      body: GLHomeContent(),
      // 3、 floatingActionButton
      floatingActionButton: FloatingActionButton(
        onPressed: () => print("FloatingActionButton"),
        child: Text("FloatingActionButton"),
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
    );
  }
}

class GLHomeContent extends StatefulWidget {
  const GLHomeContent({super.key});

  @override
  State<GLHomeContent> createState() => _GLHomeContentState();
}

class _GLHomeContentState extends State<GLHomeContent> {
  int _counter = 0;
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        // 1、 ElevatedButton
        ElevatedButton(
          child: Text(
            'ElevatedButton', // 设置按钮文本
            style: TextStyle(
              fontSize: 20, // 字体大小设置为20，你可以根据需要调整
            ),
          ),
          onPressed: () {
            // 点击按钮时执行的代码
            setState(() {
              _counter++;
            });
          },
        ),
        // 2、 OutlinedButton
        OutlinedButton(
            onPressed: () => print("OutlinedButton"),
            child: Text("OutlinedButton")),
      ],
    );
  }
}
